Skip to content

Conversation

@rintaro
Copy link
Member

@rintaro rintaro commented Dec 9, 2025

Fixes: #85922

Lexer should always set Token.CommentLength correctly because it's necessary for restoring the token position with comments. Otherwise, Token::isAtStartOfLine() might not correctly set. (see: Lexer::getStateForBeginningOfToken())

@rintaro
Copy link
Member Author

rintaro commented Dec 9, 2025

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Dec 9, 2025

@swift-ci Please smoke test macOS

@rintaro
Copy link
Member Author

rintaro commented Dec 9, 2025

@swift-ci Please smoke test Linux

Lexer should always set `Token.CommentLength` correctly because it
necessary for restoring to the token position with comments.
Otherwise, 'Token::isAtStartOfLine()' might not correctly set.
Lexer L(LangOpts, SourceMgr, BufferID, /*Diags=*/nullptr, LexerMode::Swift,
HashbangMode::Disallowed, CommentRetentionMode::None);
HashbangMode::Disallowed, CommentRetentionMode::AttachToNextToken);
Copy link
Member Author

@rintaro rintaro Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was specifically testing CommentRetentionMode::None behavior. Removing the case.
(CommentRetentionMode::AttachToNextToken behavior is tested in BOMAttachCommentNoTrivia)

@rintaro rintaro force-pushed the parser-comment-retention branch from 53fdf19 to dffd88e Compare December 10, 2025 18:25
@rintaro
Copy link
Member Author

rintaro commented Dec 10, 2025

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Dec 11, 2025

@swift-ci Please smoke test Linux

@rintaro
Copy link
Member Author

rintaro commented Dec 11, 2025

@swift-ci Please smoke test Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse error when comment appears between variable declaration and #if

2 participants